/**
 * @author Jack
 */
dojo.provide("spaghetti.dataset.api.metadata");

dojo.require("spaghetti.utility");

dojo.declare("spaghetti.dataset.api.metadata.ValidateException", Error, {
    //	summary:
    //		If the validator failed to validate the value. Throw this excepiton.
    
    constructor: function(/*String*/message){
        this.message = message;
    }
});

dojo.declare("spaghetti.dataset.api.metadata.Validator", null, {
    //	summary:
    //		The validattor interface for all the validators.
    
    validate: function(/*Object*/value) /*Throws ValidateExcetion*/{
        //	summary:
        //		Validate the value.	
        spaghetti.notImplement("validate");
    }
});

dojo.declare("spaghetti.dataset.api.metadata.Constraint", null, {
    //	summary:
    //		The constraint metadata for data. For example, identifier, validation for record's
    //		property.
    
    /*Boolean*/
    isIdentifier: function(){
        //	summary:
        //		Is this property the identifier of the record?
        
        spaghetti.notImplement("isIdentifier");
    },
    
    /*Validator*/
    getValidator: function(){
        //	summary:
        //		Get the validator for this property, can be null. If the validator is null, never
        //		validate the value.
        
        spaghetti.notImplement("getValidator");
    }
});

dojo.declare("spaghetti.dataset.api.Metadata", null, {
    //	summary:
    //		The metadata api for client data processing. Mostly, it is provide by the dataset.
    
    /*String[]*/
    getPropertyNames: function(/*Record || null*/record){
        //	summary:
        //		Get all the property names of this record. Mostly the properties only
        //		depends on dataset, not depends on the record. Not take this for granted.
        
        spaghetti.notImplement("getPropertyNames");
    },
    
    /*Object*/
    getMetaData: function(/*String*/key){
        //	summary:
        //		This is the api for other meta data of the dataset. For example, if the dataset is a
        //		subset of the whole resultset, it will hold the begin index of this dataset, and the 
        //		whole size of the resultset. If the datasource support, the dataset can be even better,
        //		it can support the meta data as current_page_index, page_row_count and page_count etc.
        //		Other meta data can be supported, depends on the datasource.
        
        spaghetti.notImplement("getMeta");
    },
    
    /*String*/
    getPropertyType: function(/*String*/property, /*Record || null*/ record){
        //	summary:
        //		Get the type for the property of the record. Mostly the property only
        //		depends on dataset.
        //
        //	property: String
        //		The property name
        //
        //	return: String
        //		The property type. Such as Object, Date, String etc., according to the protocol.
        
        spaghetti.notImplement("getPropertyType");
    },
    
    /*Constraint*/
    getPropertyConstraint: function(/*String*/property, /*Record || null*/ record){
        //	summary:
        //		Get the type for the property of the record. Mostly the property only
        //		depends on dataset.
        //
        //	property:
        //		The property name.
        
        spaghetti.notImplement("getPropertyConstraint");
    }
});